package edu.wust;

import java.io.*;

public class exam59 {

    public static void main(String[] args) throws IOException {
        File f=new File("E:\\大学作业\\JAVA俱乐部\\作业题目\\第六周\\p059_cipher.txt");
        BufferedReader r=new BufferedReader(new FileReader(f));
        String[] s=r.readLine().toString().split(",");
        int len=s.length,max1=0,max2=0,max3=0,max=0;
        int[] count=new int[100],num=new int[len];
        for(int i=0;i<len;i+=3){
            int temp=Integer.parseInt(s[i]);
            count[temp]++;
        }
        for(int i=0;i<100;++i){
            if(count[i]>max){
                max=count[i];
                max1=i;
            }
            count[i]=0;
        }
        for(int i=1;i<len;i+=3){
            int temp=Integer.parseInt(s[i]);
            count[temp]++;
        }max=0;
        for(int i=0;i<100;++i){
            if(count[i]>max){
                max=count[i];
                max2=i;
            }
            count[i]=0;
        }
        for(int i=2;i<len;i+=3){
            int temp=Integer.parseInt(s[i]);
            count[temp]++;
        }max=0;
        for(int i=0;i<100;++i){
            if(count[i]>max){
                max=count[i];
                max3=i;
            }
        }
        max1=32^max1;max2=32^max2;max3=32^max3;
        for(int i=0;i<len;++i){
            if(i%3==0)
                num[i]=max1^Integer.parseInt(s[i]);
            else if (i%3==1) {
                num[i]=max2^Integer.parseInt(s[i]);
            }
            else {
                num[i]=max3^Integer.parseInt(s[i]);
            }
        }
        int sum=0;
        for(int x:num){
            sum+=x;
            System.out.print((char)x);
        }
        System.out.println();
        System.out.println(sum);

    }
}


